home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C++
/
Frameworks
/
TransSkel++ 305
/
Documents
/
Project Models
next >
Wrap
Text File
|
1996-06-28
|
7KB
|
155 lines
The TransSkel++ Project Models
==============================
The TransSkel++ package includes a project models for use with
Symantec C++ and MetroWerks C/C++ for 68K and PPC. With these
project models, you can swiftly create TransSkel++ projects
with an Apple, File, and Edit menu, an About non-modal dialog
box, and an unlimited number of windows. You can use these
project models to learn about TransSkel++ or to serve as a
base for future TransSkel++ projects.
Installation
------------
You must first install TransSkel++ as per the installation
instructions in order to use the project models.
Beginning with release 3.05, the Project Models folder is organized
more efficiently. The downside is that you must do some assembly
in order to create project models for the desired compiler and
platform. Beginning with release 3.05, the Project Models folder
contains stationary for MetroWerks CW9 projects for both 68K and
PowerPC targets, as well as a "stationary" project (@1.π) for
Symantec C/C++. All the source files for the project are in the
"source" directory, and all the resource files are in the "resource"
directory.
Neither organization is acceptable for MetroWerks or Symantec stationary
or project models, so you must construct a project model or stationary folder
appropriate for the compiler and target machine.
Symantec C/C++
Create a folder in the Project Model folder in the (Project Models) folder
in the Symantec C/C++ folder. Call it something appropriate (e.g., "TransSkel++/SY-68K").
The name you choose will be the name that appears in the Project Modle popup
in the New Project dialog box. Place the Symantec project "@1.π" in this
folder, together with the source files in the "source" directory and the
resource file "@1.π.rsrc" in the "resource" directory. Do not copy the
folders; Symantec reads only files in a project model folder, not directories.
MetroWerks C/C++
MetroWerks project model support is a bit clumsy, so I don't
wholeheartedly recommend using it for this project. Instead,
I recommend keeping the Project Stationary folder in a safe place
and copying it when you want to create a new MetroWerks TransSkel++
project. The problem with MetroWerks stationary is that the files
which make up the stationary pad are not automatically copied like they
are in the Symantec IDE; this project model, however, requires copies
of the source code which may eventually be edited.
Creating a TransSkel++ Project
------------------------------
Symantec C/C++
After you have installed the TransSkel++ Project Model, you
may select the TransSkel++ Project in the New Project dialog
box. Symantec C++ will prompt you for a project name,
whereupon copies of the files that make up the TransSkel++
Project Model will be automatically copied to the desired
directory. The project name is adjusted accordingly.
MetroWerks C/C++
Copy the Project Stationary folder to a desired
location. Open the TransSkel++/MW-XXX.µ.stat stationary pad
and provide a name for your project. The application file
name will be automatically changed for you.
General Description
-------------------
The TransSkel++ Project Model defines subclasses of the
TransSkel++ base classes corresponding to the typical objects
in an application: An Apple menu with one About… item, a File
menu with a New, Open…, Close, Save, Save As…, Page Setup…,
Print, and Quit item, an Edit menu with the standard Undo,
Cut, Copy, Paste, and Clear items, an About dialog box with an
OK button, and an unlimited number of resizeable windows.
Finally, there is the application itself, which routes events
to the various objects mentioned above.
The classes defined for managing these Macintosh objects are
described in detail below.
• CApp Superclass: CApplication
The CApp class is the only subclass of the CApplication
class, and only one instance is created in main(). (See
main.cp) One global pointer, gApp, is set to the address of
the only instance of this class, and this pointer serves as
a global means of accessing all major objects in the
application.
This class shadows the CApplication doMenuHook() virtual
function, which adjusts the Close item in the File menu,
depending on whether any windows are open.
• C_AppleMenu Superclass: CAppleMenu
A subclass of CAppleMenu is needed to shadow the CAppleMenu
doSelect virtual function. The C_AppleMenu's doSelect
member function opens the application's About dialog box.
• CFileMenu Superclass: CMenu
The CFile menu's doSelect member function creates a new
C_Window if the New item was selected, closes the frontmost
window if one was open and the Close item was selected, and
signals to exit the application if the Quit item was
selected.
• CEditMenu Superclass: CMenu
The CEditMenu class doesn't do much of anything and is
provided for compatability with the User Interface
Guidelines and for future use in the project.
• CAboutDialog Superclass: CDialog
The CAboutDialog class includes a filter member function
doFilter, which correctly draws the dialog button if the
dialog is activated or deactivated and maps keystrokes to
button actions. The doSelect member function closes the
dialog via the CDialog doClose memberfunction (which only
calls HideWindow()).
• C_Window Superclass: CWindow
The C_Window class is a bit of a dummy class; it's
primarily here as an example and a template for future use
in a project. The doClose member function deletes the
instance of the owning class, which turns out to be safe
because automatic invocation of doClose() makes no future
references to the referent of 'this'.
You'll typically want to modify all of the above files in some
way. I generally place all the variables I would make global
in the CApp class so as to minimize global storage. If you
add functionality to your menus, you'll want to edit the
CFileMenu and CEditMenu classes, or add definitions for new
ones. Similarly, the C_Window class serves as a template for
new window definitions.